package hn.cch.spring.bean.aware;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.BeansException;
import org.springframework.beans.factory.BeanNameAware;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
import org.springframework.lang.NonNull;

public class BeanNameAwareImpl implements BeanNameAware, ApplicationContextAware {

    private static final Logger logger = LoggerFactory.getLogger(BeanNameAwareImpl.class);


    @Override
    public void setBeanName(@NonNull String beanName) {
        logger.info("setBeanName:{}", beanName);
    }

    @Override
    public void setApplicationContext(@NonNull ApplicationContext applicationContext) throws BeansException {
        logger.info("setApplicationContext:{}", applicationContext);
    }

    @Autowired
    public void testAutowired( ApplicationContext applicationContext) {
        logger.info("testAutowired:{}", applicationContext);
    }
}
